package com.example.sxt_practise.thread;


import java.util.ArrayList;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author gaofeng
 * @date 2022年05月26日 20:57
 */
public class UnSafeListTest {
    public static void main(String[] args) throws InterruptedException {
     ArrayList<String> stuName = new ArrayList<>() ;
     CopyOnWriteArrayList stuAddr = new CopyOnWriteArrayList() ;
        for (int i = 0; i < 10000; i++) {
            new Thread(() -> stuName.add(Thread.currentThread().getName())).start();
        }
        Thread.sleep(3000);

        System.out.println(stuName.size());
    }
}
